home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / i_am_leg.swf / scripts / DefineSprite_650 / frame_3 / DoAction.as
Encoding:
Text File  |  2010-04-12  |  2.6 KB  |  119 lines

  1. anzeige.text = this.energy;
  2. xwalkspeedakt = xwalkspeed + _root.speedausgleich;
  3. diffx = Math.round(this._x - _root.huntpos._x);
  4. diffy = Math.round(this._y - _root.huntpos._y);
  5. if(this.fadeit == true)
  6. {
  7.    if(this._alpha > 0 && this.fadewaiter > 30)
  8.    {
  9.       this._alpha -= 10;
  10.    }
  11.    else if(this._alpha < 0)
  12.    {
  13.       stop();
  14.       this.removeMovieClip();
  15.    }
  16.    else
  17.    {
  18.       fadewaiter += 1;
  19.    }
  20. }
  21. if(this.alive == "true")
  22. {
  23.    if(_root.playeralive == true)
  24.    {
  25.       if(random(50) < 3)
  26.       {
  27.          this.walkallowed = true;
  28.       }
  29.       else if(random(50) == 4)
  30.       {
  31.          this.walkallowed = false;
  32.       }
  33.       if(this.walkallowed == true)
  34.       {
  35.          if(diffx > 2)
  36.          {
  37.             this._xscale = 86;
  38.             this._x -= xwalkspeedakt;
  39.          }
  40.          else if(diffx < 0)
  41.          {
  42.             this._xscale = -86;
  43.             this._x += xwalkspeedakt;
  44.          }
  45.          if(diffy > 8)
  46.          {
  47.             this._y -= ywalkspeed;
  48.          }
  49.          else if(diffy < 5)
  50.          {
  51.             this._y += ywalkspeed;
  52.          }
  53.       }
  54.       else
  55.       {
  56.          this._x -= _root.speedausgleich;
  57.       }
  58.    }
  59. }
  60. else
  61. {
  62.    this._x -= _root.speedausgleich;
  63. }
  64. this.getroffen = false;
  65. a = _root.shotactive - 20;
  66. while(a < _root.shotactive + 1)
  67. {
  68.    if(_root["shot" + a].hitTest(this.enemy.hitbox) == true)
  69.    {
  70.       _root["shot" + a].removeMovieClip();
  71.       this.getroffen = true;
  72.    }
  73.    a++;
  74. }
  75. if(this.alive != "deathsceneplayed")
  76. {
  77.    if(_root.player.hitbox.hitTest(this.enemy.hitbox) == true || _root.player.hitbox.hitTest(this.enemy.hitbox2) == true)
  78.    {
  79.       if(_root.playeralive == true && this.att_act == false)
  80.       {
  81.          this.att_act = true;
  82.          _root.playeralive = false;
  83.          _root.die_init();
  84.          _root.player.gotoAndStop("die");
  85.          this.enemy.gotoAndPlay("att");
  86.       }
  87.    }
  88.    if(this.getroffen == true && this.att_act == false)
  89.    {
  90.       this.energy -= _root.durchschlag;
  91.       if(this.energy < 0.5)
  92.       {
  93.          _root.actives -= 1;
  94.          this.alive = "false";
  95.          _root.bodycount += 1;
  96.          _root.score_txt += 1000;
  97.          this.enemy.gotoAndPlay("die");
  98.          this.alive = "deathsceneplayed";
  99.       }
  100.       else
  101.       {
  102.          if(xwalkspeed > 2)
  103.          {
  104.             xwalkspeed -= 1;
  105.          }
  106.          _root.score_txt += 150;
  107.          this.enemy.gotoAndPlay("inj");
  108.          if(diffx > 0)
  109.          {
  110.             this._x += 20;
  111.          }
  112.          else if(diffx < 0)
  113.          {
  114.             this._x -= 20;
  115.          }
  116.       }
  117.    }
  118. }
  119.